"""
Copyright (c) 2023 - present SKbioinfo
"""
from flask_restful import Api
from apps.API.auth.interface_auth import interfaceLogin,interfaceResigster
from apps.API.project.interface_project import interfaceProject,interfaceProjectID
from apps.API.sample.interface_sample import interfaceSampleUpload,interfaceSample
from apps.API.sample.interface_sample import interfaceSampleID,interfaceSampleAdd
from apps.API.sample.interface_sample import interfaceSampleInstock
from apps.API.user.interface_user import interfaceUser,interfaceRole,interfaceQueryUser,interfaceUserID
from apps.API.service.interface_service import interfaceService
from apps.API.receipt.interface_receipt import interfaceQueryReceipt, interfaceReturn,interfaceReceipt,interfaceReceiptCheck
from apps.API.receipt.interface_receipt import interfaceReceiptID,interfaceRecheck
from apps.API.record.interfaceRecord import interfaceRecord,interfaceQueryHistory
from apps.API.API_config import API_SETTING

def register_api(apps):
    ### INITIAL RESTFUL API ###
    api=Api(apps)
    ### SETTING API URL ###
    APIs=API_SETTING.API_config
    ### REGISTER AUTH API ###
    api.add_resource(interfaceLogin,APIs["LOGIN_API"])
    api.add_resource(interfaceResigster,APIs["REGISTER_API"])
    ### REGISTER USER API ###
    api.add_resource(interfaceUser,APIs["USER_API"])
    api.add_resource(interfaceUserID, APIs["USER_API"] + "/<string:id>")
    api.add_resource(interfaceRole,APIs["USER_API"] + "/roles")
    api.add_resource(interfaceQueryUser,APIs["USER_API"] + "/query")
    ### REGISTER PROJECT API ###
    api.add_resource(interfaceProject,APIs["PROJECT_API"])
    api.add_resource(interfaceProjectID,APIs["PROJECT_API"] + "/<string:id>")
    ### REGISTER SAMPLE API ###
    api.add_resource(interfaceSample,APIs["SAMPLE_API"])
    api.add_resource(interfaceSampleUpload,APIs["SAMPLE_API"] + "/upload")
    api.add_resource(interfaceSampleID,APIs["SAMPLE_API"] + "/<int:id>")
    api.add_resource(interfaceSampleAdd,APIs["SAMPLE_API"] + "/add")
    api.add_resource(interfaceSampleInstock,APIs["SAMPLE_API"] + "/<string:action>")
    ### REGISTER SERVICE API ###
    api.add_resource(interfaceService,APIs["SERVICE_API"])
    ### REGISTER RECEIPT API ###
    api.add_resource(interfaceReceipt,APIs["SERVICE_API"] + "/receipt")
    api.add_resource(interfaceReceiptID,APIs["SERVICE_API"] + "/receipt/<string:id>")
    api.add_resource(interfaceReturn,APIs["SERVICE_API"] + "/return")
    api.add_resource(interfaceQueryReceipt,APIs["SERVICE_API"] + "/receipt/query")
    api.add_resource(interfaceReceiptCheck,APIs["SERVICE_API"] + "/receipt/<string:action>")
    api.add_resource(interfaceRecheck, APIs["SERVICE_API"] + "/receipt/recheck/<string:action>")
    ### REGISTER RECORD API ###
    api.add_resource(interfaceRecord,APIs["RECORD_API"])
    api.add_resource(interfaceQueryHistory,APIs["RECORD_API"] + "/query")